
//
//  XYKeyboardView.m
//  Zhihuijinfu
//
//  Created by XY Lv on 17/3/28.
//  Copyright © 2017年 王笛. All rights reserved.
//

#import "XYKeyboardView.h"
#import "XYSubviewsStyle.h"
@implementation XYKeyboardView

- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if(self){
        [self xyInitSubviewsWithFrame:frame];
    }
    return self;
}

- (void)xyInitSubviewsWithFrame:(CGRect)frame{
    _xyTextView = [[XYTextView alloc ]initWithFrame:CGRectMake(xyPadding, xyPadHalf, WDScreenW - xyPadding*2 - xySendBtnW, frame.size.height - xyPadHalf *2)];
    [self addSubview:_xyTextView];
//    _xyTextView.layer.borderColor = [UIColor lightGrayColor].CGColor;
//    _xyTextView.layer.borderWidth = 0.25;
    
    _xySendBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [self addSubview:_xySendBtn];
    _xySendBtn.frame = CGRectMake(CGRectGetMaxX(_xyTextView.frame) + xyPadding, _xyTextView.frame.origin.y, xySendBtnW, CGRectGetHeight(_xyTextView.frame));
    [self addSubview:_xySendBtn];
    [_xySendBtn setTitle:@"发送" forState:UIControlStateNormal];
    _xySendBtn.titleLabel.font = [UIFont systemFontOfSize:xy(13)];
    [_xySendBtn setTitleColor:xyPublisTimeTextColor forState:UIControlStateNormal];
    [_xySendBtn addTarget:self action:@selector(xySendTextClick:) forControlEvents:UIControlEventTouchUpInside];
}

- (void)xySendTextClick:(UIButton *)sender{
    if(self.delegate && [self.delegate respondsToSelector:@selector(xySendTextBtnClick:withObject:)]){
        [self.delegate xySendTextBtnClick:sender withObject:self];
    }
}


@end
















